package com.crop.back.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 质量检测记录表
 * </p>
 *
 * @author 作者
 * @since 2025-02-04
 */
@Getter
@Setter
@TableName("quality_inspection")
@ApiModel(value = "QualityInspection对象", description = "质量检测记录表")
public class QualityInspection implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("批次ID")
    @TableField("batch_id")
    private Long batchId;

    @ApiModelProperty("检测人员")
    @TableField("inspector")
    private String inspector;

    @ApiModelProperty("检测时间")
    @TableField("inspection_time")
    private LocalDateTime inspectionTime;

    @ApiModelProperty("检测项目，JSON格式。示例：
    [
        {
            \"item_id\": 1,
            \"name\": \"农药残留\",
            \"standard\": \"GB 2763-2021\",
            \"method\": \"气相色谱法\",
            \"unit\": \"mg/kg\",
            \"limit_value\": 0.1
        },
        {
            \"item_id\": 2,
            \"name\": \"重金属含量\",
            \"standard\": \"GB 2762-2017\",
            \"method\": \"原子吸收分光光度法\",
            \"unit\": \"mg/kg\",
            \"limit_value\": 0.2
        }
    ]")
    @TableField("inspection_items")
    private String inspectionItems;

    @ApiModelProperty("检测结果，JSON格式。示例：
    [
        {
            \"item_id\": 1,
            \"tested_value\": 0.05,
            \"is_qualified\": true,
            \"notes\": \"符合标准要求\"
        },
        {
            \"item_id\": 2,
            \"tested_value\": 0.15,
            \"is_qualified\": true,
            \"notes\": \"符合标准要求\"
        }
    ]")
    @TableField("results")
    private String results;

    @ApiModelProperty("检测报告URL")
    @TableField("report_url")
    private String reportUrl;

    @ApiModelProperty("状态：0-不合格 1-合格")
    @TableField("status")
    private Integer status;

    @TableField("create_time")
    private LocalDateTime createTime;

    @TableField("update_time")
    private LocalDateTime updateTime;

    @TableField("deleted")
    private Boolean deleted;


}
